# Maintainer: Luca Weiss <luca@z3ntu.xyz>
# Contributor: Brandon Boese <brandonboese@protonmail.com>
pkgname=lomiri-thumbnailer
pkgver=3.0.3
pkgrel=1
pkgdesc="D-Bus service for out of process thumbnailing"
url="https://gitlab.com/ubports/development/core/lomiri-thumbnailer"
arch="all"
license="GPL-3.0-only"
depends="
	dconf
	"
depends_dev="
	boost-dev
	gdk-pixbuf-dev
	gst-plugins-base-dev
	gstreamer-dev
	gtest-dev
	leveldb-dev
	libapparmor-dev
	libexif-dev
	librsvg-dev
	lomiri-api-dev
	persistent-cache-cpp-dev
	qt5-qtdeclarative-dev
	qt5-qtquickcontrols2-dev
	taglib-dev
	"
makedepends="
	$depends_dev
	cmake
	cmake-extras
	doxygen
	gmock
	libqtdbustest
	samurai
	"
checkdepends="
	xvfb-run
	"
subpackages="$pkgname-dev $pkgname-doc"
source="https://gitlab.com/ubports/development/core/lomiri-thumbnailer/-/archive/$pkgver/lomiri-thumbnailer-$pkgver.tar.gz
	fix-googletest.patch
	disable-qml-and-dbus-tests.patch
	manually-disable-tests.patch
	"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_INSTALL_SYSCONFDIR=/etc \
		-DCMAKE_INSTALL_LOCALSTATEDIR=/var
	cmake --build build
}

check() {
	ctest --test-dir build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
	# uncompressed man pages
	rm "$pkgdir"/usr/share/man/man1/lomiri-thumbnailer-admin.1
	rm "$pkgdir"/usr/share/man/man1/thumbnailer-service.1
	rm "$pkgdir"/usr/share/man/man5/thumbnailer-settings.5
}

sha512sums="
4f64cfaf79273edcd9cf1a27b23b2d55fdc06d61a0e80f4be095b9034c269a28535ece5f558dd1b42bae4465da1444b5eb1716c2c94a34533fefc8aaae5a15f7  lomiri-thumbnailer-3.0.3.tar.gz
51f9aea7dd5ebc66012df4efcaf6f84bdfdb43ac3c0168e662ad6d8f5029aa806aea876ecb9b6c78376feff80d6937ff1de868ca20301814dd99a93c8baf5978  fix-googletest.patch
27181c3acd8ddd17f4b85c331c98143e45e440d7411dfa1fa6252be9013b2804291f9d194579163925a97fc9fdb2a52fc572aec6bb8230d2fd49cd8f29730d02  disable-qml-and-dbus-tests.patch
664007046cec229fb9ace9428a512064aa4e4993a451a8aa2c597d3e1088ddd7569fd8a6811148fabd1ec9dd9fb3e3e8ba2dfb7a0d497b40cfa42653e7ff14d9  manually-disable-tests.patch
"
